//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2022 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if compiler(>=5.5.2) && canImport(_Concurrency)

import SotoCore

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension RolesAnywhere {
    // MARK: Async API Calls

    /// Creates a profile. A profile is configuration resource to list the roles that RolesAnywhere service is trusted to assume. In addition, by applying a profile you can intersect permissions with IAM managed policies.  Required permissions:  rolesanywhere:CreateProfile.
    public func createProfile(_ input: CreateProfileRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ProfileDetailResponse {
        return try await self.client.execute(operation: "CreateProfile", path: "/profiles", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Creates a trust anchor. You establish trust between IAM Roles Anywhere and your certificate authority (CA) by configuring a trust anchor. A Trust Anchor is defined either as a reference to a AWS Certificate Manager Private Certificate Authority (ACM PCA), or by uploading a Certificate Authority (CA) certificate. Your AWS workloads can authenticate with the trust anchor using certificates issued by the trusted Certificate Authority (CA) in exchange for temporary AWS credentials.  Required permissions:  rolesanywhere:CreateTrustAnchor.
    public func createTrustAnchor(_ input: CreateTrustAnchorRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> TrustAnchorDetailResponse {
        return try await self.client.execute(operation: "CreateTrustAnchor", path: "/trustanchors", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Deletes a certificate revocation list (CRL).  Required permissions:  rolesanywhere:DeleteCrl.
    public func deleteCrl(_ input: ScalarCrlRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> CrlDetailResponse {
        return try await self.client.execute(operation: "DeleteCrl", path: "/crl/{crlId}", httpMethod: .DELETE, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Deletes a profile.  Required permissions:  rolesanywhere:DeleteProfile.
    public func deleteProfile(_ input: ScalarProfileRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ProfileDetailResponse {
        return try await self.client.execute(operation: "DeleteProfile", path: "/profile/{profileId}", httpMethod: .DELETE, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Deletes a trust anchor.  Required permissions:  rolesanywhere:DeleteTrustAnchor.
    public func deleteTrustAnchor(_ input: ScalarTrustAnchorRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> TrustAnchorDetailResponse {
        return try await self.client.execute(operation: "DeleteTrustAnchor", path: "/trustanchor/{trustAnchorId}", httpMethod: .DELETE, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Disables a certificate revocation list (CRL).  Required permissions:  rolesanywhere:DisableCrl.
    public func disableCrl(_ input: ScalarCrlRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> CrlDetailResponse {
        return try await self.client.execute(operation: "DisableCrl", path: "/crl/{crlId}/disable", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Disables a profile. When disabled, CreateSession requests with this profile fail.  Required permissions:  rolesanywhere:DisableProfile.
    public func disableProfile(_ input: ScalarProfileRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ProfileDetailResponse {
        return try await self.client.execute(operation: "DisableProfile", path: "/profile/{profileId}/disable", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Disables a trust anchor. When disabled, CreateSession requests specifying this trust anchor are unauthorized.  Required permissions:  rolesanywhere:DisableTrustAnchor.
    public func disableTrustAnchor(_ input: ScalarTrustAnchorRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> TrustAnchorDetailResponse {
        return try await self.client.execute(operation: "DisableTrustAnchor", path: "/trustanchor/{trustAnchorId}/disable", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Enables a certificate revocation list (CRL). When enabled, certificates stored in the CRL are unauthorized to receive session credentials.  Required permissions:  rolesanywhere:EnableCrl.
    public func enableCrl(_ input: ScalarCrlRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> CrlDetailResponse {
        return try await self.client.execute(operation: "EnableCrl", path: "/crl/{crlId}/enable", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Enables the roles in a profile to receive session credentials in CreateSession.   Required permissions:  rolesanywhere:EnableProfile.
    public func enableProfile(_ input: ScalarProfileRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ProfileDetailResponse {
        return try await self.client.execute(operation: "EnableProfile", path: "/profile/{profileId}/enable", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Enables a trust anchor. When enabled, certificates in the trust anchor chain are authorized for trust validation.   Required permissions:  rolesanywhere:EnableTrustAnchor.
    public func enableTrustAnchor(_ input: ScalarTrustAnchorRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> TrustAnchorDetailResponse {
        return try await self.client.execute(operation: "EnableTrustAnchor", path: "/trustanchor/{trustAnchorId}/enable", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Gets a certificate revocation list (CRL).  Required permissions:  rolesanywhere:GetCrl.
    public func getCrl(_ input: ScalarCrlRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> CrlDetailResponse {
        return try await self.client.execute(operation: "GetCrl", path: "/crl/{crlId}", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Gets a profile.  Required permissions:  rolesanywhere:GetProfile.
    public func getProfile(_ input: ScalarProfileRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ProfileDetailResponse {
        return try await self.client.execute(operation: "GetProfile", path: "/profile/{profileId}", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Gets a Subject. A Subject associates a certificate identity with authentication attempts by CreateSession. The Subject resources stores audit information such as status of the last authentication attempt, the certificate data used in the attempt, and the last time the associated identity attempted authentication.   Required permissions:  rolesanywhere:GetSubject.
    public func getSubject(_ input: ScalarSubjectRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> SubjectDetailResponse {
        return try await self.client.execute(operation: "GetSubject", path: "/subject/{subjectId}", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Gets a trust anchor.  Required permissions:  rolesanywhere:GetTrustAnchor.
    public func getTrustAnchor(_ input: ScalarTrustAnchorRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> TrustAnchorDetailResponse {
        return try await self.client.execute(operation: "GetTrustAnchor", path: "/trustanchor/{trustAnchorId}", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Imports the certificate revocation list (CRL). CRl is a list of certificates that have been revoked by the issuing certificate Authority (CA). IAM Roles Anywhere validates against the crl list before issuing credentials.   Required permissions:  rolesanywhere:ImportCrl.
    public func importCrl(_ input: ImportCrlRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> CrlDetailResponse {
        return try await self.client.execute(operation: "ImportCrl", path: "/crls", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Lists all Crls in the authenticated account and Amazon Web Services Region.  Required permissions:  rolesanywhere:ListCrls.
    public func listCrls(_ input: ListRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListCrlsResponse {
        return try await self.client.execute(operation: "ListCrls", path: "/crls", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Lists all profiles in the authenticated account and Amazon Web Services Region.  Required permissions:  rolesanywhere:ListProfiles.
    public func listProfiles(_ input: ListRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListProfilesResponse {
        return try await self.client.execute(operation: "ListProfiles", path: "/profiles", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Lists the subjects in the authenticated account and Amazon Web Services Region.  Required permissions:  rolesanywhere:ListSubjects.
    public func listSubjects(_ input: ListRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListSubjectsResponse {
        return try await self.client.execute(operation: "ListSubjects", path: "/subjects", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Lists the tags attached to the resource.  Required permissions:  rolesanywhere:ListTagsForResource.
    public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListTagsForResourceResponse {
        return try await self.client.execute(operation: "ListTagsForResource", path: "/ListTagsForResource", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Lists the trust anchors in the authenticated account and Amazon Web Services Region.  Required permissions:  rolesanywhere:ListTrustAnchors.
    public func listTrustAnchors(_ input: ListRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ListTrustAnchorsResponse {
        return try await self.client.execute(operation: "ListTrustAnchors", path: "/trustanchors", httpMethod: .GET, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Attaches tags to a resource.  Required permissions:  rolesanywhere:TagResource.
    public func tagResource(_ input: TagResourceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> TagResourceResponse {
        return try await self.client.execute(operation: "TagResource", path: "/TagResource", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Removes tags from the resource.  Required permissions:  rolesanywhere:UntagResource.
    public func untagResource(_ input: UntagResourceRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> UntagResourceResponse {
        return try await self.client.execute(operation: "UntagResource", path: "/UntagResource", httpMethod: .POST, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Updates the certificate revocation list (CRL). CRl is a list of certificates that have been revoked by the issuing certificate Authority (CA). IAM Roles Anywhere validates against the crl list before issuing credentials.  Required permissions:  rolesanywhere:UpdateCrl.
    public func updateCrl(_ input: UpdateCrlRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> CrlDetailResponse {
        return try await self.client.execute(operation: "UpdateCrl", path: "/crl/{crlId}", httpMethod: .PATCH, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Updates the profile. A profile is configuration resource to list the roles that RolesAnywhere service is trusted to assume. In addition, by applying a profile you can scope-down permissions with IAM managed policies.  Required permissions:  rolesanywhere:UpdateProfile.
    public func updateProfile(_ input: UpdateProfileRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> ProfileDetailResponse {
        return try await self.client.execute(operation: "UpdateProfile", path: "/profile/{profileId}", httpMethod: .PATCH, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }

    /// Updates the trust anchor.You establish trust between IAM Roles Anywhere and your certificate authority (CA) by configuring a trust anchor. A Trust Anchor is defined either as a reference to a AWS Certificate Manager Private Certificate Authority (ACM PCA), or by uploading a Certificate Authority (CA) certificate. Your AWS workloads can authenticate with the trust anchor using certificates issued by the trusted Certificate Authority (CA) in exchange for temporary AWS credentials.  Required permissions:  rolesanywhere:UpdateTrustAnchor.
    public func updateTrustAnchor(_ input: UpdateTrustAnchorRequest, logger: Logger = AWSClient.loggingDisabled, on eventLoop: EventLoop? = nil) async throws -> TrustAnchorDetailResponse {
        return try await self.client.execute(operation: "UpdateTrustAnchor", path: "/trustanchor/{trustAnchorId}", httpMethod: .PATCH, serviceConfig: self.config, input: input, logger: logger, on: eventLoop)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension RolesAnywhere {
    ///  Lists all Crls in the authenticated account and Amazon Web Services Region.  Required permissions:  rolesanywhere:ListCrls.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listCrlsPaginator(
        _ input: ListRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListRequest, ListCrlsResponse> {
        return .init(
            input: input,
            command: self.listCrls,
            inputKey: \ListRequest.nextToken,
            outputKey: \ListCrlsResponse.nextToken,
            logger: logger,
            on: eventLoop
        )
    }

    ///  Lists all profiles in the authenticated account and Amazon Web Services Region.  Required permissions:  rolesanywhere:ListProfiles.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listProfilesPaginator(
        _ input: ListRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListRequest, ListProfilesResponse> {
        return .init(
            input: input,
            command: self.listProfiles,
            inputKey: \ListRequest.nextToken,
            outputKey: \ListProfilesResponse.nextToken,
            logger: logger,
            on: eventLoop
        )
    }

    ///  Lists the subjects in the authenticated account and Amazon Web Services Region.  Required permissions:  rolesanywhere:ListSubjects.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listSubjectsPaginator(
        _ input: ListRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListRequest, ListSubjectsResponse> {
        return .init(
            input: input,
            command: self.listSubjects,
            inputKey: \ListRequest.nextToken,
            outputKey: \ListSubjectsResponse.nextToken,
            logger: logger,
            on: eventLoop
        )
    }

    ///  Lists the trust anchors in the authenticated account and Amazon Web Services Region.  Required permissions:  rolesanywhere:ListTrustAnchors.
    /// Return PaginatorSequence for operation.
    ///
    /// - Parameters:
    ///   - input: Input for request
    ///   - logger: Logger used flot logging
    ///   - eventLoop: EventLoop to run this process on
    public func listTrustAnchorsPaginator(
        _ input: ListRequest,
        logger: Logger = AWSClient.loggingDisabled,
        on eventLoop: EventLoop? = nil
    ) -> AWSClient.PaginatorSequence<ListRequest, ListTrustAnchorsResponse> {
        return .init(
            input: input,
            command: self.listTrustAnchors,
            inputKey: \ListRequest.nextToken,
            outputKey: \ListTrustAnchorsResponse.nextToken,
            logger: logger,
            on: eventLoop
        )
    }
}

#endif // compiler(>=5.5.2) && canImport(_Concurrency)
